/// 实现一个系统app的自增计算器
///
import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    title: 'StatefulWidget',
    theme: ThemeData(
      primaryColor: Colors.orange,
    ),
    home: const MyHome(),
  ));
}

class MyHome extends StatefulWidget {
  const MyHome({super.key});

  @override
  State<MyHome> createState() {
    // TODO: implement createState
    return _HomepageState();
  }
}

class _HomepageState extends State<MyHome> {
  int _count = 0;

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: const Text('计算器'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          setState(() {
            _count++;
          });
        },
        child: const Icon(Icons.add),
      ),
      body: Center(
        child: Column(
          children: [
            Text(
              '$_count',
              style: const TextStyle(fontSize: 26),
            )
          ],
        ),
      ),
    );
  }
}
